import { Popover } from 'antd';
import styles from '../pages/global.less';

import {data_cols,data_cols2} from '../../config/data'

const basic = data_cols
const keys = Object.keys(basic)

// 获取系统档案表格表头数据
const getCols = () => {
    var cols = []
    keys.forEach(key => {
        var col = {
            key: key,
            dataIndex: key,
            title: basic[key][0].split("（")[0],
            width: basic[key][1],
            // align: 'center',
            className: styles.cols,
            multi: basic[key][4],
            render: (text) => {
                return (
                    text.map((t, id) =>
                        <Popover key={id} content={<h1>{t}</h1>} trigger="hover">
                            <div>{t}</div>
                        </Popover>
                    )
                )
            }
        }
        if (basic[key][3] !== '') col['fixed'] = basic[key][3]
        cols.push(col)
    });
    return cols
}

const getTag = () => {
    var cols = []
    keys.forEach(key => {
        var col = {
            key: key,
            title: basic[key][0].split("（")[0],
            tags: []
        }
        if (basic[key][2]) cols.push(col)
    });
    return cols
}


export { getCols, getTag }